
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from django.shortcuts import render
import json
from django.db import connection
import requests
import json
@csrf_exempt
def ajax_test(request):
    return render(request, 'ajax/inde.html', locals())



@csrf_exempt
def find_by_address(request):
    if request.method == 'POST':
        print("哈哈哈哈哈哈哈哈哈哈哈哈")
        print(request.body)       # b'user-name=1&user-email=1%40q.com'
        data = {}
        name = request.POST.get('name')
        address = request.POST.get('address')
        print(name)
        print(address)
        data['name'] = name
        data['address'] = address
        data = json.dumps(data)
        print(data)
        print(type(data))
    return HttpResponse(data, content_type="application/json")


